//
//  SHComposeButton.swift
//  SHWeibo01
//
//  Created by 卫平玉 on 16/7/29.
//  Copyright © 2016年 卫平玉. All rights reserved.
//

import UIKit

class SHComposeButton: UIButton {

    // 模型
    var composeButtonInfo: SHComposeButtonInfo?
    // 干掉按钮高亮效果
    override var highlighted: Bool{
        get{
            return false
        }
        
        set{
            
        }
    }
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
   private func setupUI(){
        
    imageView?.contentMode = .Center
    
    titleLabel?.textAlignment = .Center
    
    titleLabel?.font = UIFont.systemFontOfSize(15)
    
    setTitleColor(UIColor.darkGrayColor(), forState: UIControlState.Normal)
    
    }
    
    // 对其子控件重新布局
    override func layoutSubviews() {
        super.layoutSubviews()
        
        imageView?.frame = CGRectMake(0, 0, self.frame.width, self.frame.width)
        
        titleLabel?.frame = CGRectMake(0, self.frame.width, self.frame.width, self.frame.height - self.frame.width)
    }

}
